package com.ysy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum StorageType {

    ALIYUN(1,"阿里云"), MINIO(2,"MINIO")
    ;
    private final Integer type;
    private final String desc;

    private static final Map<Integer,StorageType> cacheMap;

    static {
        cacheMap = Arrays.stream(StorageType.values()).collect(Collectors.toMap(StorageType::getType, e -> e));
    }
    public static StorageType getStorageType(Integer key) {
       return cacheMap.get(key);
    }


}
